<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/cookie.js"></script>
</head>

<body>
    <button class="set">创建</button>
    <button class="get">获取</button>
    <button class="edit">修改</button>
</body>
<script>
    var set = document.getElementsByClassName("set")[0];
    var get = document.getElementsByClassName("get")[0];
    var edit = document.getElementsByClassName("edit")[0];

    // 如何修改cookie?
    // 对应键名设置键值  (没有就新增,有就修改)


    set.onclick = function () {
        setCookie("user", "a123123", 31);
        setCookie("pwd", "123123", 31);
        setCookie("phone", "17386141517", 31);
        setCookie("email", "123123@qq.com", 31);
    }

    get.onclick = function () {
        console.log(getCookie("user"));
        console.log(getCookie("pwd"));
        console.log(getCookie("phone"));
        console.log(getCookie("email"));
        console.log(getCookie("heihei"));
    }

    edit.onclick = function(){
        setCookie("user", "b123123", 7);
        setCookie("pwd", "123321", 7);
        setCookie("phone", "1738666666", 7);
        setCookie("email", "99999@qq.com", 7);
    }

    
</script>

</html>